# -*- bazel -*-

load("@drake//tools/skylark:py.bzl", "py_library")

licenses([
    "notice",  # Apache-2.0 AND BSD-3-Clause AND Python-2.0
    "reciprocal",  # MPL-2.0
    "restricted",  # LGPL-2.1-only AND LGPL-3.0-or-later
    "unencumbered",  # Public-Domain
])

# drake-visualizer has the following non-system dependencies in addition to
# those declared in deps:
#   bot2-lcmgl: LGPL-3.0-or-later
#   ctkPythonConsole: Apache-2.0
#   Eigen: BSD-3-Clause AND MPL-2.0 AND Public-Domain
#   Python: Python-2.0
#   PythonQt: LGPL-2.1-only
#   QtPropertyBrowser: LGPL-2.1-only
# TODO(jamiesnape): Enumerate system dependencies.

py_library(
    name = "drake_visualizer_python_deps",
    deps = [
        "@lcm//:lcm-python",
        # TODO(eric.cousineau): Expose VTK Python libraries here for Linux.
    ],
    visibility = ["//visibility:public"],
)

filegroup(
    name = "drake_visualizer",
    srcs = glob([
        "lib/**/*.dylib",
        "lib/**/*.py",
        "lib/**/*.so",
        "lib/**/*.so.1",  # vtk-8 libraries present in Linux.
    ]) + [
        "bin/drake-visualizer",
        "share/doc/director/LICENSE.txt",
    ],
    data = [
        # N.B. We do NOT depend on our WORKSPACE copy of VTK here, even though
        # drake-visualizer uses VTK. The VTK libraries used by drake-visualizer
        # are part of the pre-compiled image and therefore are part of the srcs
        # glob immediately above.
        ":drake_visualizer_python_deps",
        "@lcm//:libdrake_lcm.so",
    ],
    visibility = ["//visibility:public"],
)

load("@drake//tools/install:install.bzl", "install_files")

install_files(
    name = "install",
    dest = ".",
    files = [":drake_visualizer"],
    rename = {
        # Try to 'hide' the binary so that they only use the wrapper script.
        "bin/drake-visualizer": ".drake-visualizer-real",
    },
    visibility = ["//visibility:public"],
)
